<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>terminal_interface-curses-aux.adb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
*.comment {
	color: green;
}
*.symbol {
	color: red;
}
</style>
</head>
<body>
<hr><div style="text-align:center"><h1> File : terminal_interface-curses-aux.adb </h1></div><hr>
<pre>
<span class="comment"><em>------------------------------------------------------------------------------</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>--                           <strong>GNAT</strong> ncurses Binding                           --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>--                      Terminal_Interface.Curses.Aux                       --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>--                                 B O D Y                                  --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>------------------------------------------------------------------------------</em></span>
<span class="comment"><em>-- Copyright 2020 Thomas E. Dickey                                          --</em></span>
<span class="comment"><em>-- Copyright 1999-2003,2009 Free Software Foundation, Inc.                  --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>-- Permission is hereby granted, free of charge, to any person obtaining a  --</em></span>
<span class="comment"><em>-- copy of this software and associated documentation files (the            --</em></span>
<span class="comment"><em>-- "Software"), to deal in the Software without restriction, including      --</em></span>
<span class="comment"><em>-- without limitation the rights to use, copy, modify, merge, publish,      --</em></span>
<span class="comment"><em>-- distribute, distribute with modifications, sublicense, and/or sell       --</em></span>
<span class="comment"><em>-- copies of the Software, and to permit persons to whom the Software is    --</em></span>
<span class="comment"><em>-- furnished to do so, subject to the following conditions:                 --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>-- The above copyright notice and this permission notice shall be included  --</em></span>
<span class="comment"><em>-- in all copies or substantial portions of the Software.                   --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</em></span>
<span class="comment"><em>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</em></span>
<span class="comment"><em>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</em></span>
<span class="comment"><em>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</em></span>
<span class="comment"><em>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</em></span>
<span class="comment"><em>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</em></span>
<span class="comment"><em>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</em></span>
<span class="comment"><em>--                                                                          --</em></span>
<span class="comment"><em>-- Except as contained in this notice, the name(s) of the above copyright   --</em></span>
<span class="comment"><em>-- holders shall not be used in advertising or otherwise to promote the     --</em></span>
<span class="comment"><em>-- sale, use or other dealings in this Software without prior written       --</em></span>
<span class="comment"><em>-- authorization.                                                           --</em></span>
<span class="comment"><em>------------------------------------------------------------------------------</em></span>
<span class="comment"><em>--  Author:  Juergen Pfeifer, 1996</em></span>
<span class="comment"><em>--  Version Control:</em></span>
<span class="comment"><em>--  @Revision: 1.12 @</em></span>
<span class="comment"><em>--  Binding Version 01.00</em></span>
<span class="comment"><em>------------------------------------------------------------------------------</em></span>
<b>package</b> <b>body</b> <a href="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</a>.<a href="terminal_interface-curses__ads.htm#ref_48_28">Curses</a>.<span class="symbol"><a name="ref_42_40" href="terminal_interface-curses-aux__ads.htm#ref_46_35">Aux</a></span> <b>is</b>
   <span class="comment"><em>--</em></span>
   <span class="comment"><em>--  Some helpers</em></span>
   <b>procedure</b> <span class="symbol"><a name="ref_45_14" href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a></span> (<span class="symbol"><a name="ref_45_27" href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a></span>  : chars_ptr;
                          <span class="symbol"><a name="ref_46_27" href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a></span> : <b>out</b> String)
   <b>is</b>
      <span class="comment"><em>--  Fill the string with the characters referenced by the</em></span>
      <span class="comment"><em>--  chars_ptr.</em></span>
      <span class="comment"><em>--</em></span>
      <span class="symbol"><a name="ref_51_7">Len</a></span> : Natural;
   <b>begin</b>
      <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a> /= Null_Ptr <b>then</b>
         <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> := Natural (Strlen (<a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a>));
         <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Length &lt; <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> <b>then</b>
            <b>raise</b> Constraint_Error;
         <b>end</b> <b>if</b>;
         <b>declare</b>
            <span class="symbol"><a name="ref_59_13">S</a></span> : String (1 .. <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a>);
         <b>begin</b>
            <a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a> := Value (<a href="terminal_interface-curses-aux__ads.htm#ref_91_27">Cp</a>);
            <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a> (<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First .. (<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First + <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> - 1)) := <a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a> (<a href="terminal_interface-curses-aux__adb.htm#ref_59_13">S</a>'<b>Range</b>);
         <b>end</b>;
      <b>else</b>
         <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> := 0;
      <b>end</b> <b>if</b>;

      <b>if</b> <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a> &lt; <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Length <b>then</b>
         <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a> ((<a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'First + <a href="terminal_interface-curses-aux__adb.htm#ref_51_7">Len</a>) .. <a href="terminal_interface-curses-aux__ads.htm#ref_92_27">Str</a>'Last) := (<b>others</b> =&gt; ' ');
      <b>end</b> <b>if</b>;

   <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a>;

   <b>function</b> <span class="symbol"><a name="ref_74_13" href="terminal_interface-curses-aux__ads.htm#ref_96_13">Fill_String</a></span> (<span class="symbol"><a name="ref_74_26" href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a></span> : chars_ptr) <b>return</b> String
   <b>is</b>
      <span class="symbol"><a name="ref_76_7">Len</a></span> : Natural;
   <b>begin</b>
      <b>if</b> <a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a> /= Null_Ptr <b>then</b>
         <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a> := Natural (Strlen (<a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a>));
         <b>if</b> <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a> = 0 <b>then</b>
            <b>return</b> "";
         <b>else</b>
            <b>declare</b>
               <span class="symbol"><a name="ref_84_16">S</a></span> : String (1 .. <a href="terminal_interface-curses-aux__adb.htm#ref_76_7">Len</a>);
            <b>begin</b>
               <a href="terminal_interface-curses-aux__ads.htm#ref_91_14">Fill_String</a> (<a href="terminal_interface-curses-aux__ads.htm#ref_96_26">Cp</a>, <a href="terminal_interface-curses-aux__adb.htm#ref_84_16">S</a>);
               <b>return</b> <a href="terminal_interface-curses-aux__adb.htm#ref_84_16">S</a>;
            <b>end</b>;
         <b>end</b> <b>if</b>;
      <b>else</b>
         <b>return</b> "";
      <b>end</b> <b>if</b>;
   <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_96_13">Fill_String</a>;

   <b>procedure</b> <span class="symbol"><a name="ref_95_14" href="terminal_interface-curses-aux__ads.htm#ref_87_14">Eti_Exception</a></span> (<span class="symbol"><a name="ref_95_29" href="terminal_interface-curses-aux__ads.htm#ref_87_29">Code</a></span> : <a href="terminal_interface-curses-aux__ads.htm#ref_70_9">Eti_Error</a>)
   <b>is</b>
   <b>begin</b>
      <b>case</b> <a href="terminal_interface-curses-aux__ads.htm#ref_87_29">Code</a> <b>is</b>
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_85_7">E_Ok</a>              =&gt; <b>null</b>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_84_7">E_System_Error</a>    =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_528_4">Eti_System_Error</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_83_7">E_Bad_Argument</a>    =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_529_4">Eti_Bad_Argument</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_82_7">E_Posted</a>          =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_530_4">Eti_Posted</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_81_7">E_Connected</a>       =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_531_4">Eti_Connected</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_80_7">E_Bad_State</a>       =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_532_4">Eti_Bad_State</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_79_7">E_No_Room</a>         =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_533_4">Eti_No_Room</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_78_7">E_Not_Posted</a>      =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_534_4">Eti_Not_Posted</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_77_7">E_Unknown_Command</a> =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_535_4">Eti_Unknown_Command</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_76_7">E_No_Match</a>        =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_536_4">Eti_No_Match</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_75_7">E_Not_Selectable</a>  =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_537_4">Eti_Not_Selectable</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_74_7">E_Not_Connected</a>   =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_538_4">Eti_Not_Connected</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_73_7">E_Request_Denied</a>  =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_539_4">Eti_Request_Denied</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_72_7">E_Invalid_Field</a>   =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_540_4">Eti_Invalid_Field</a>;
         <b>when</b> <a href="terminal_interface-curses-aux__ads.htm#ref_71_7">E_Current</a>         =&gt; <b>raise</b> <a href="terminal_interface-curses__ads.htm#ref_541_4">Eti_Current</a>;
      <b>end</b> <b>case</b>;
   <b>end</b> <a href="terminal_interface-curses-aux__ads.htm#ref_87_14">Eti_Exception</a>;

<b>end</b> <a href="terminal_interface__ads.htm#ref_43_9">Terminal_Interface</a>.<a href="terminal_interface-curses__ads.htm#ref_48_28">Curses</a>.<a href="terminal_interface-curses-aux__ads.htm#ref_46_35">Aux</a>;
</pre></body></html>
